﻿CREATE PROCEDURE [dbo].[Stores_UpdateFromTempStores]
	@CountryId smallint
AS
	UPDATE Stores
	SET Name = temp.Name, 
		PBL = temp.PBL,
		Region = temp.Region,
		SubRegion = temp.SubRegion,
		State = temp.State,
		City = temp.City,
		Address = temp.Address,		  
		Phone = temp.Phone,
		Fax = temp.Fax,
		Mail = temp.Mail,
		Contact = temp.Contact,
		SiteLocation = temp.SiteLocation,
		SELCustomers = temp.SELCustomers,
		SELLocation = temp.SELLocation, 
		Layout = temp.Layout,
		ShoppingOccasion = temp.ShoppingOccasion,
		OpeningHours = temp.OpeningHours,
		ShopType = temp.ShopType,
		Attribute1 = temp.Attribute1,
		Attribute2 = temp.Attribute2,
		Format = temp.Format,
		Size = temp.Size
	FROM Stores st 
	Inner join TempStores temp on st.Code = temp.Code
	WHERE st.CountryId = @CountryId